JavaScript

Check Console for Output

For Explanation Click Here

Variables

1.What will be the output of this code?
    console.log(x);
    var x=5;
    
A:Output: undefined

2.What will be the output of this code?
    console.log(a);
    var a;
    
A:Output: undefined

3.What will be the output of this code?
    console.log(b);
    b=10;
    var b;
    
A:Output: undefined

4.What will happen here?
    console.log(c);
    
A:Reference Error: c is not defined

5.What will be the output of this code?
    console.log(e);
    var e=10;
    console.log(e);
    e=20;
    console.log(e);
    
A:Output: undefined 10 20

6.What will be the output of this code?
    console.log(f);
    var f=100;
    var f;
    console.log(f);
    
A:Output: undefined 100

7.What will be the output of this code?
    console.log(g);
    var g=g+1;
    console.log(g);
    
A:Output: undefined NaN

8.What will be the output of this code?
    var h;
    console.log(h);
    h=50;
    console.log(h);
    
A:Output: undefined 50

9.What will be the output of this code?
    console.log(i);
    i=10;
    var i=5;
    console.log(i);
    
A:Output: undefined 5